//
//  BXNavigationController.m
//  BaoXianDaiDai
//
//  Created by JYJ on 15/5/28.
//  Copyright (c) 2015年 baobeikeji.cn. All rights reserved.
//

#import "BXNavigationController.h"

@interface BXNavigationController () <UINavigationControllerDelegate>
@end

@implementation BXNavigationController

//+ (void)initialize {
//    // 设置UIUINavigationBar的主题
//    [self setupNavigationBarTheme];
//}

- (void)viewDidLoad {
    [super viewDidLoad];
    // 就有滑动返回功能
    self.interactivePopGestureRecognizer.delegate = nil;
    [[UINavigationBar appearance] setTranslucent:NO];//网页获取相册被导航栏遮挡
}

/**
 *  设置UIBarButtonItem的主题
 */
+ (void)setupNavigationBarTheme {
    // 通过appearance对象能修改整个项目中所有UIBarbuttonItem的样式
    UINavigationBar *appearance = [UINavigationBar appearance];
    
    // 1.设置导航条的背景
    [appearance setBackgroundImage:[UIImage createImageWithColor:ThemeColor] forBarMetrics:UIBarMetricsDefault];
    [appearance setTintColor:[UIColor whiteColor]];
    // 设置title文字
    NSMutableDictionary *att = [NSMutableDictionary dictionary];
    att[NSFontAttributeName] = [UIFont systemFontOfSize:20];
    att[NSForegroundColorAttributeName] = [UIColor whiteColor];
    [appearance setTitleTextAttributes:att];
    
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
}
// 重写自定义的UINavigationController中的push方法
// 处理tabbar的显示隐藏
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
     if (self.childViewControllers.count==1) {
         viewController.hidesBottomBarWhenPushed = YES; //viewController是将要被push的控制器
     }
     [super pushViewController:viewController animated:animated];
}


@end
